package lib.wzh.com.libcore.framework.chain;

import lib.wzh.com.libcore.framework.enums.ResponseEnum;
import lib.wzh.com.libcore.framework.response.BaseResponse;

/**
 * @Author lib
 * @Date 2021/12/4 14:03
 * @ClassName ReturnEmpty
 * @Version v1.0
 */

public class ReturnEmpty extends ReturnChain{
    @Override
    public <T> BaseResponse<T> returnHandler(T data) {
        if(null == data){
            return new BaseResponse<>(ResponseEnum.FAIL.code(), ResponseEnum.FAIL.msg(), ResponseEnum.FAIL.success());
        }else {
            if(null != getChain()){
                return getChain().returnHandler(data);
            }
            return new BaseResponse<>(ResponseEnum.SUCCESS.code(), ResponseEnum.SUCCESS.msg(), ResponseEnum.SUCCESS.success(),data);
        }
    }

}
